﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AHMHRIRSF01.aspx.cs" Inherits="apps_ahmic_pages_AHMHRIRSF01" %>
<div class="form-outer">
    <div class="form-header" id="formHeader" runat="server">
    </div>
    <div class="sub-pages" id="formContentOuter" runat="server">
        <div class="sub-page sub-page-default" data-section="new" data-path="QCC / QCM>Tema Masuk">
            <div class="form-maincontent form-block grid">
                <div class="row">
                     <div class="span6">
                        <h2><i class="icon-newspaper on-left"></i>Detail Project</h2>
	                    <label>Jenis Project</label>
	                    <div class="input-control select">
		                    <select name="vtype" id="ahmhrirsf01_vtype" runat="server">
		                    </select>
	                    </div>	
	                    <label>Kondisi Sebelum</label>
	                    <div class="input-control textarea">
		                    <textarea name="vbefore"></textarea>
	                    </div>
	                    <label>Rencana Improvement</label>
	                    <div class="input-control textarea">
		                    <textarea name="vimprovement"></textarea>
	                    </div>
	                    <label>Kondisi Sesudah</label>
	                    <div class="input-control textarea">
		                    <textarea name="vafter"></textarea>
	                    </div>
                        <br/><br/>
                        <h2><i class="icon-accessibility on-left"></i>Profil Tim</h2>
	                    <label>Nama Tim</label>
                        <div class="input-control text" data-role="input-control">
		                    <input type="text" name="namatim" value="">
		                    <button class="btn-clear" tabindex="-1"></button>
	                    </div>

	                    <label>Tanggal Pendaftaran</label>
                        <div class="input-control text" data-role="datepicker">
		                    <input type="text">
		                    <button class="btn-date"></button>
	                    </div>

	                    <label>Extension</label>
	                    <div class="input-control text" data-role="input-control">
		                    <input type="text" name="vext" value="">
		                    <button class="btn-clear" tabindex="-1"></button>
	                    </div>

	                    <label>Tema ke-</label>
	                    <div class="input-control select">
		                    <select>
			                    <option>1</option>
			                    <option>2</option>
			                    <option>3</option>
		                    </select>
	                    </div>	

	                    <label>Judul makalah</label>
	                    <div class="input-control textarea">
		                    <textarea name="vtitle"></textarea>
	                    </div>	
                        <br/><br/>
                    </div>
                    <div class="span6">
	                    <h2><i class="icon-accessibility on-left"></i>Profil Anggota</h2>
				        <table id="ahmhrirsf01_tblMember" class="responsiveTable table hovered border">
					        <thead>
						        <tr>
							        <th class="tblHeader text-left priority4 rowNumber">No.</th>
							        <th class="tblHeader text-left mainfield priority1" data-field-id="vnama">Nama</th>
							        <th class="tblHeader text-left priority3" data-field-id="vnrp">NRP</th>
							        <th class="tblHeader text-left priority2 hidden" data-field-id="vroleid">Role ID</th>
							        <th class="tblHeader text-left priority2" data-field-id="vrolename">Role</th>
							        <th class="tblHeader text-left priority1 actionColumn" data-field-id="vaction">Action</th>
						        </tr>
					        </thead>
					        <tbody>
					        </tbody>
				        </table>	
		            <div style=" text-align: right; clear: both; ">
		            <button class="button medium" id="ahmhrirsf01_btnAddMember" type="button" onclick="ahmhrirsf01_openAddNewMemberForm(this);"><i class="icon-plus on-left"></i>Tambah Peserta</button>			
		            </div>			
                    <br/><br/>
	                <h2><i class="icon-calendar on-left"></i>Rencana Langkah</h2>

				            <table id="ahmhrirsf01_tblRencanaLangkah" class="responsiveTable table hovered border myClass">  
					            <thead>
						            <tr>
							            <th class="tblHeader text-left priority4 rowNumber">No.</th>
							            <th class="tblHeader text-left mainfield priority1" data-field-id="dstart">Tgl Mulai</th>
							            <th class="tblHeader text-left priority2" data-field-id="dend">Tgl Selesai</th>
							            <th class="tblHeader text-left priority1 actionColumn" data-field-id="vaction">Action</th>
						            </tr>
					            </thead>
					            <tbody>
					            </tbody>
				            </table>	
		            <div style="text-align: right;clear: both;">
			            <button class="button medium" type="button"  onclick="ahmhrirsf01_openRencanaLangkahForm(this);" ><i class="icon-plus on-left"></i>Add Activity</button>
                    </div>

	            </div>
                </div>
            </div>

            <div class="main-form-toolbar-bottom">
                <button type="button" class="medium primary" >
	                <span class="icon-floppy"></span>
                    Save Data
                </button>
            </div>
        </div>
        <div class="sub-page" data-section="add-member" data-path="QCC / QCM>Tema Masuk>Tambah Peserta">
            <div class="form-maincontent form-block grid">
                <div class="row">
                    <div class="span6">
 	                    <label>NRP</label>
                        <div class="input-control text" data-role="input-control">
		                    <input type="text" name="vnrp" value="">
		                    <button class="btn-lookup" onclick="ahmhrirsf01_openMemberLookup(this)" ></button>
	                    </div>
 	                    <label>Nama</label>
                        <div class="input-control text" data-role="input-control">
		                    <input type="text" name="vnama" value="">
		                    <button class="btn-lookup" onclick="ahmhrirsf01_openMemberLookup(this)" ></button>
	                    </div>
 	                    <label>Role</label>
                        <div class="input-control select" data-role="input-control" id="ahmhrirsf01_vroleselect" runat="server">
                            
	                    </div>
                    </div>
                </div>
            </div>            
            <div class="main-form-toolbar-bottom">
                <button type="button" class="medium primary" onclick="ahmhrirsf01_addNewMember(this)" >
	                <span class="icon-floppy"></span>
                    Tambah Peserta
                </button>
            </div>
        </div>
        <div class="sub-page" data-section="lookup-member" data-path="QCC / QCM>Tema Masuk>Tambah Peserta>Pilih Peserta" data-url="apps/ahmic/pages/AHMHRIRSL01.aspx">

        </div>
        <div class="sub-page" data-section="add-step" data-path="QCC / QCM>Tema Masuk>Tambah Rencana Langkah">
            <div class="form-maincontent form-block grid">
                <div class="row">
                     <div class="span6">
	                    <label>Tanggal Mulai</label>
                        <div class="input-control text" data-role="datepicker">
		                    <input type="text" name="dstart">
		                    <button class="btn-date"></button>
	                    </div>
	                    <label>Tanggal Selesai</label>
                        <div class="input-control text" data-role="datepicker">
		                    <input type="text" name="dend">
		                    <button class="btn-date"></button>
	                    </div>
	                 </div>	
                 </div>	
             </div>	
            <div class="main-form-toolbar-bottom">
                <button type="button" class="medium primary" onclick="ahmhrirsf01_addRencanaLangkah(this)" >
	                <span class="icon-floppy"></span>
                    Save Data
                </button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function ahmhrirsf01_openAddNewMemberForm(obj) {
        _fw_formResetFields($('.sub-page[data-section="add-member"]'));
        _fw_navigateSubPage(obj, 'add-member');
    }
    function ahmhrirsf01_addNewMember(obj){
        var obj = $(obj);
        var frm = obj.closest('.sub-page');
        var ofrm = obj.closest('.tab-frame');
        _fw_validation_clear(obj);
        _fw_validation_add(obj, 'vnrp', 'required');
        _fw_validation_add(obj, 'vnama', 'required');
        if (_fw_validation_validate(obj)) {
            var item = {
                'vnama': $('input[name="vnama"]', frm).val(),
                'vnrp': $('input[name="vnrp"]', frm).val(),
                'vroleid': $('select[name="vrole"]').val(),
                'vrolename': $('select[name="vrole"] option:selected').text(),
                'vaction': _fw_tableActionLinks(true, true)
            }

            if ($('table#ahmhrirsf01_tblMember td input[name="vnrp"][value="' + $('input[name="vnrp"]', frm).val() + '"]').length > 0) {
                _fw_setMessage(ofrm, 0, 'Data already exists');
            } else {
                var newRow = _fw_tableAddRow('ahmhrirsf01_tblMember', item, true);
                _fw_navigateSubPage(obj, 'new');
                _fw_navigateToObject(newRow);
            }
        }
    }
    function ahmhrirsf01_openMemberLookup(obj) {
        var obj = $(obj);
        var fval = obj.prev().val();
        var frm = obj.closest('.sub-page');
        var ofrm = obj.closest('.tab-frame');
        var lookupFrm = $('.sub-page[data-section="lookup-member"]', ofrm);
        var param = {'filter_nrp':fval}
        _fw_loadSubPage(lookupFrm, param);
        _fw_navigateSubPage(obj, 'lookup-member');
    }
    function ahmhrirsl01_select(obj) {
        var obj = $(obj);
        var ofrm = obj.closest('.tab-frame');
        var nrp = $('td[data-field-id="vnrp"] .field-value', obj.closest('tr')).text();
        var nama = $('td[data-field-id="vnama"] .field-value', obj.closest('tr')).text();
        var frameTarget = $('.sub-page[data-section="add-member"]');
        $('input[name="vnrp"]', frameTarget).val(nrp);
        $('input[name="vnama"]', frameTarget).val(nama);
        _fw_navigateSubPage(obj, 'add-member');
    }
    function ahmhrirsf01_openRencanaLangkahForm(obj) {
        var obj = $(obj);
        var frm = obj.closest('.tab-frame');
        $('.sub-page[data-section="add-step"] input[name="dstart"]', frm).val('');
        $('.sub-page[data-section="add-step"] input[name="dend"]', frm).val('');
        _fw_navigateSubPage(obj, 'add-step');
    }
    function ahmhrirsf01_addRencanaLangkah(obj) {
        var obj = $(obj);
        var frm = obj.closest('.sub-page');
        var ofrm = obj.closest('.tab-frame');
        _fw_validation_clear(obj);
        _fw_validation_add(obj, 'dstart', 'required');
        _fw_validation_add(obj, 'dend', 'required');
        if (_fw_validation_validate(obj)) {
            var item = {
                'dstart': $('input[name="dstart"]', frm).val(),
                'dend': $('input[name="dend"]', frm).val(),
                'vaction': _fw_tableActionLinks(true, true)
            }

            var newRow = _fw_tableAddRow('ahmhrirsf01_tblRencanaLangkah', item, true);
            _fw_navigateSubPage(obj, 'new');
            _fw_navigateToObject(newRow);
        }
    }
</script>